import request from '@/utils/request'

export interface CreateOrderParams {
  serviceType: string
  amount: number
  description?: string
}

export interface OrderQueryParams {
  page: number
  size: number
  status?: string
  startTime?: string
  endTime?: string
}

// 创建订单
export const createOrder = (data: CreateOrderParams) => {
  return request.post('/api/orders/create', data)
}

// 获取订单列表
export const getOrderList = (params: OrderQueryParams) => {
  return request.get('/api/orders/list', { params })
}

// 获取订单详情
export const getOrderDetail = (orderNo: string) => {
  return request.get(`/api/orders/detail/${orderNo}`)
}

// 取消订单
export const cancelOrder = (orderNo: string) => {
  return request.post(`/api/orders/cancel/${orderNo}`)
}

// 获取订单状态
export const getOrderStatus = (orderNo: string) => {
  return request.get(`/api/orders/status/${orderNo}`)
}
